#!/usr/bin/env python

import matplotlib.pyplot as plt

count1 = [None]*30
count2 = [None]*30

count1[0]=[5, 10, 16, 36, 47, 64, 83, 102, 113, 125] ; count2[0]=[5, 10, 16, 30, 40, 53, 58, 50, 51, 48];
count1[1]=[18, 40, 50, 56, 66, 80, 95, 104, 119, 139] ; count2[1]=[18, 40, 50, 50, 43, 38, 40, 46, 45, 41];
count1[2]=[11, 25, 40, 45, 58, 73, 90, 103, 116, 125] ; count2[2]=[11, 25, 40, 39, 35, 39, 40, 37, 38, 37];
count1[3]=[13, 24, 39, 54, 65, 81, 92, 99, 115, 133] ; count2[3]=[13, 24, 27, 35, 36, 52, 45, 48, 56, 52];
count1[4]=[18, 34, 49, 68, 79, 84, 101, 119, 127, 131] ; count2[4]=[18, 34, 49, 48, 50, 51, 51, 53, 55, 56];
count1[5]=[18, 37, 61, 82, 105, 111, 126, 135, 151, 155] ; count2[5]=[18, 37, 61, 56, 49, 52, 46, 47, 46, 48];
count1[6]=[20, 36, 60, 81, 100, 118, 137, 153, 164, 169] ; count2[6]=[20, 36, 40, 61, 45, 38, 40, 31, 25, 25];
count1[7]=[11, 18, 35, 54, 71, 81, 103, 121, 139, 161] ; count2[7]=[11, 18, 27, 46, 48, 42, 38, 52, 44, 51];
count1[8]=[18, 29, 35, 39, 57, 68, 85, 104, 118, 134] ; count2[8]=[18, 29, 35, 36, 48, 45, 36, 46, 41, 41];
count1[9]=[14, 33, 50, 67, 86, 109, 124, 140, 155, 173] ; count2[9]=[14, 33, 19, 17, 32, 22, 22, 22, 22, 40];
count1[10]=[19, 30, 44, 59, 79, 97, 113, 123, 137, 156] ; count2[10]=[19, 30, 22, 37, 39, 32, 39, 32, 30, 39];
count1[11]=[16, 37, 57, 76, 87, 99, 110, 136, 149, 168] ; count2[11]=[16, 37, 40, 24, 16, 25, 19, 45, 39, 33];
count1[12]=[13, 26, 43, 63, 78, 96, 110, 125, 140, 152] ; count2[12]=[13, 26, 43, 46, 48, 48, 48, 45, 50, 48];
count1[13]=[15, 24, 46, 60, 82, 98, 124, 141, 156, 176] ; count2[13]=[15, 24, 46, 51, 34, 35, 33, 27, 28, 43];
count1[14]=[20, 43, 59, 73, 85, 104, 111, 124, 142, 159] ; count2[14]=[20, 43, 59, 54, 53, 53, 55, 52, 49, 50];
count1[15]=[17, 34, 47, 65, 84, 96, 111, 127, 135, 154] ; count2[15]=[17, 34, 47, 48, 45, 41, 40, 40, 42, 38];
count1[16]=[17, 29, 42, 56, 72, 88, 95, 111, 126, 143] ; count2[16]=[17, 29, 28, 42, 48, 45, 43, 41, 48, 49];
count1[17]=[12, 28, 45, 63, 79, 95, 105, 125, 132, 152] ; count2[17]=[12, 28, 32, 25, 41, 45, 43, 34, 33, 38];
count1[18]=[4, 27, 38, 48, 62, 77, 96, 117, 135, 153] ; count2[18]=[4, 27, 38, 44, 56, 56, 54, 46, 45, 49];
count1[19]=[14, 29, 42, 61, 80, 90, 104, 115, 129, 146] ; count2[19]=[14, 29, 25, 44, 38, 38, 44, 40, 38, 34];
count1[20]=[19, 28, 43, 58, 72, 82, 94, 105, 118, 130] ; count2[20]=[19, 28, 34, 49, 43, 40, 42, 41, 29, 26];
count1[21]=[15, 18, 24, 37, 42, 53, 69, 81, 102, 120] ; count2[21]=[15, 18, 24, 21, 24, 30, 28, 23, 30, 40];
count1[22]=[16, 31, 43, 58, 71, 85, 100, 118, 133, 155] ; count2[22]=[16, 17, 29, 44, 38, 41, 35, 42, 44, 42];
count1[23]=[15, 27, 38, 55, 71, 82, 98, 117, 129, 146] ; count2[23]=[15, 11, 14, 31, 47, 45, 43, 43, 48, 44];
count1[24]=[12, 26, 38, 52, 61, 75, 84, 97, 101, 109] ; count2[24]=[12, 26, 27, 32, 41, 43, 39, 34, 37, 38];
count1[25]=[14, 29, 44, 53, 66, 86, 95, 110, 122, 131] ; count2[25]=[14, 29, 26, 35, 28, 28, 32, 43, 40, 34];
count1[26]=[12, 27, 41, 53, 63, 75, 93, 115, 134, 149] ; count2[26]=[12, 27, 31, 35, 31, 43, 42, 51, 48, 58];
count1[27]=[17, 37, 47, 59, 65, 77, 85, 105, 117, 134] ; count2[27]=[17, 37, 36, 48, 45, 46, 46, 53, 54, 55];
count1[28]=[19, 34, 41, 60, 71, 78, 94, 112, 130, 144] ; count2[28]=[19, 13, 16, 35, 28, 27, 30, 48, 46, 45];
count1[29]=[22, 39, 57, 66, 74, 91, 110, 125, 143, 155] ; count2[29]=[22, 39, 34, 37, 31, 37, 31, 25, 41, 38];

plt.figure(figsize=(4,3))

x = range(1,7)

for i in range(30):
	plt.clf()
	plt.plot(x,count1[i][:6],"y.-",label="Sequential")
	plt.plot(x,count2[i][:6],"b*-",label="Composition")
	plt.legend()
	plt.xlabel('Update Number')
	plt.ylabel('Operation Number')
	plt.savefig("figs/mergeeffert/%d.png"%i,dpi=300,bbox_inches="tight")